UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QWtebtICiKOPpNuPj8O6rc73wXeAcK3L5qjqJ4xwcAY='
WHERE
key_id = 'f0acbd85767e94dac07a70b6515e44c009d111a4cbab5e0483c1e744972080e7'
AND (
token = 'QWtebtICiKOPpNuPj8O6rc73wXeAcK3L5qjqJ4xwcAY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)