UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MSy5FntY/lf1zfBbF6WZzDDKGvO+TJTAf++7Ke6TSMc=' 
WHERE 
  key_id = 'd8fd3161562a6d8608fc5e206a75df9010fd614d973e133c2634664703b48986' 
  AND (
    token = 'MSy5FntY/lf1zfBbF6WZzDDKGvO+TJTAf++7Ke6TSMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053