UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dwJKdDLSNGSExAUEV592ySsuleX6Wu9cz/b5Y39OsTs=' 
WHERE 
  key_id = '5542dbfa7fa259fadf3500a8ce0f0d565df16928cff747ad0276e603f984805d' 
  AND (
    token = 'dwJKdDLSNGSExAUEV592ySsuleX6Wu9cz/b5Y39OsTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025