UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4+wrsEnK4uGvJYILerK392aTMXyqVEcWva0l4Mr866M=' 
WHERE 
  key_id = '1043e2ae6401f102c0bc880255b1dbced3e5ad51922fc94ba8964d67a46540d3' 
  AND (
    token = '4+wrsEnK4uGvJYILerK392aTMXyqVEcWva0l4Mr866M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026