UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'crfrkm4J9SVjTslfzgyFF3ejTbrZyo1237+bXm4rhEo=' 
WHERE 
  key_id = '4a68adc79dc3a667b6f1a11f884b38b0948ac4f8a4f4a08ed344813356423e09' 
  AND (
    token = 'crfrkm4J9SVjTslfzgyFF3ejTbrZyo1237+bXm4rhEo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029