UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iZ2dNNVGg6qeN2JvaE8MxboYv7gEG9zbi5JFXcbONCU='
WHERE
key_id = '8346111fbc6b6eb49570393b7daaf883f8fa0339c2301e73f04cfea68b639aa9'
AND (
token = 'iZ2dNNVGg6qeN2JvaE8MxboYv7gEG9zbi5JFXcbONCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)