UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cDVK0bq43oXnDUM/9a2Rk95MCwunQKm+64iN/tmAJmc=' 
WHERE 
  key_id = 'f9c7d88f39fdb0f51bee984ba6fc050f5bdbe355602b90c68df6dd0bfcedb3f8' 
  AND (
    token = 'cDVK0bq43oXnDUM/9a2Rk95MCwunQKm+64iN/tmAJmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033