UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '16qMTiO7WS1Y5NvuSMjwjAEuIlMgaG34xI5p9z5Beos='
WHERE
key_id = 'a4412771884e34564328f77acd5d51a7ed4f8ce4f9ce6635742da98fb9dc90c6'
AND (
token = '16qMTiO7WS1Y5NvuSMjwjAEuIlMgaG34xI5p9z5Beos='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)