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

Query time 0.00034