UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'krb+wdhLO/YEK+ORLggoBHgE6NcZ7crN4/6wEATYwvo=' 
WHERE 
  key_id = '88c5920e7ada8046b65f6781b95a4a527851bacabe000d0c39f41513d2926ef0' 
  AND (
    token = 'krb+wdhLO/YEK+ORLggoBHgE6NcZ7crN4/6wEATYwvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021