UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ew2ufajvEE68n1YlenQr4Sm3nkJh+yAqttMKjZn6saU=' 
WHERE 
  key_id = 'c94651d6dab8a7dd9c89f1711cb0f12a5bd1e3a5c666d8a2e836d34212e98995' 
  AND (
    token = 'ew2ufajvEE68n1YlenQr4Sm3nkJh+yAqttMKjZn6saU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034