UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7uLnDOSgpEoGI1TxQkxUXJt8dra0C3/eleoWY+kqE40=' 
WHERE 
  key_id = '27339e2dac23ab28fd2ef4961e56caa8508e28184a7b4fc1ff4ead997babb413' 
  AND (
    token = '7uLnDOSgpEoGI1TxQkxUXJt8dra0C3/eleoWY+kqE40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025