UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y8ewJ9+QecVqLrD2y2oUhk7hAk6R2d9g4xyvA3BItlk=' 
WHERE 
  key_id = '1a3bd2e0ac06f9d5363366e3514c1be675cf4dbd8f9783f3b10d21f55a7cfb1d' 
  AND (
    token = 'Y8ewJ9+QecVqLrD2y2oUhk7hAk6R2d9g4xyvA3BItlk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030