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

Query time 0.00033