UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KH99uQfKa6biWpCVwxXLgNElgCbGwbdRxU52cYsS8Go='
WHERE
key_id = '495294fb0d649de860f3f939482d916fa43a807f0bb0bc2773e1d8699d15fbd6'
AND (
token = 'KH99uQfKa6biWpCVwxXLgNElgCbGwbdRxU52cYsS8Go='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)