UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BtGaokeKnpcMWGU13sU2g0pJ3AyFEC4I8v6cK6S6zC8='
WHERE
key_id = '963c1dc9ed31f2b90f5d76ba25326fd328fb4021f259703bb4f3901e744142aa'
AND (
token = 'BtGaokeKnpcMWGU13sU2g0pJ3AyFEC4I8v6cK6S6zC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)