UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C/qqxUseTX58vMW49mlx24DznmLJVHXOEa2V14FxaL0='
WHERE
key_id = '321a6c32bf799f7b8bf0d7839fcd178c5a627f878bddd3189323097cbebad4fd'
AND (
token = 'C/qqxUseTX58vMW49mlx24DznmLJVHXOEa2V14FxaL0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)