UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0y91Og0ZFTvf7ouM42FU9jFYwKH1tzeYdpqg0TMY6Js='
WHERE
key_id = 'c2bf2a35fe1e46279527b9c25604717a0225ef10fab25806357ed6c53f46c6c3'
AND (
token = '0y91Og0ZFTvf7ouM42FU9jFYwKH1tzeYdpqg0TMY6Js='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)