UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xxOR9TaOCTh/SaIMgPD2TQHLEcRFAGXe01v1I0+Tzro=' 
WHERE 
  key_id = 'd7e12c791151011bcd2e866984a9c3c3e2552778c40620217f0a83649f13ecf7' 
  AND (
    token = 'xxOR9TaOCTh/SaIMgPD2TQHLEcRFAGXe01v1I0+Tzro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018