UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ok7XfqnXNNbiKn8RL7S2ByX+E792V4lZdCD3MGMuplk=' 
WHERE 
  key_id = 'fc436682cb2cf5d280fe24982f7b3741986f41d4b539ce521f1cb45db347164e' 
  AND (
    token = 'ok7XfqnXNNbiKn8RL7S2ByX+E792V4lZdCD3MGMuplk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025