UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '961cqWxttXkplrgABj7zNhDyXDgA0S8v2tEfT+e0yMw=' 
WHERE 
  key_id = '1ff1fc20116b36fdbc4bd66b220d78008d8f19cbc3316b5a666398e2088885a7' 
  AND (
    token = '961cqWxttXkplrgABj7zNhDyXDgA0S8v2tEfT+e0yMw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054