UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EM5TUfoVRgMo3oznjCa0LOR3didNGMrKEOxVL62uy+Y=' 
WHERE 
  key_id = 'c17018f51bf4bb570728768275d599bf1c46e36632a8a996d09f4201fe2c4ffe' 
  AND (
    token = 'EM5TUfoVRgMo3oznjCa0LOR3didNGMrKEOxVL62uy+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027