UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XQ2xR4lCnPSGuox3fFEBiqWZk4qUi0jCRPOsoE52mV4=' 
WHERE 
  key_id = 'f87285e016a7c00f98fc1f7a48d8413ad88649c20f186fded492eb391afb566d' 
  AND (
    token = 'XQ2xR4lCnPSGuox3fFEBiqWZk4qUi0jCRPOsoE52mV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029