UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j++nENP2kDFJ6/5b61dkLzHt3ZiL1qwxamYXpETslYc=' 
WHERE 
  key_id = 'c9538c185a629715f01370b125c38cb6cd3dd527defb91851a8d40528ee9b1e6' 
  AND (
    token = 'j++nENP2kDFJ6/5b61dkLzHt3ZiL1qwxamYXpETslYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049