UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6NL/kfMCOLuSxBKMgG5D9mcmC79y5Eolqcld9XkaEg4='
WHERE
key_id = '3c21323eb0ee59bd0810de780faa15184068a51e9e677676934076d8a29e5a07'
AND (
token = '6NL/kfMCOLuSxBKMgG5D9mcmC79y5Eolqcld9XkaEg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)