UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W4vJgD9aWZ5yPBLoQ+5ObOr1xLTre4IVHr0wdg4u8no='
WHERE
key_id = '34f38c5d18b7d86e00e6303227c3238bfa0c983ea035a5b8faa4aee038d090a7'
AND (
token = 'W4vJgD9aWZ5yPBLoQ+5ObOr1xLTre4IVHr0wdg4u8no='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)