UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't9uKnR3V6/O4ZsPzON4s27fUMu1FC3nhsYHeXUrR+Z0=' 
WHERE 
  key_id = '4410f90b893a33b2a8f3a5af0faead35ae9a929b3f19fd4af887105d75e63d48' 
  AND (
    token = 't9uKnR3V6/O4ZsPzON4s27fUMu1FC3nhsYHeXUrR+Z0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029