UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XqBnOP8q/Z0+R5Zo2u3gSGlp7j1sTWALMzzfblFDUms=' 
WHERE 
  key_id = '19d988c1746a5e3605999cdad31edb5a78635cb65c60be7480b82f990ef950e6' 
  AND (
    token = 'XqBnOP8q/Z0+R5Zo2u3gSGlp7j1sTWALMzzfblFDUms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049