UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J8kn7rlx21fuHoq2T29cL+588fV5gR/gtPerSW7CFik='
WHERE
key_id = 'd3ac0772d3e02c0787c8c036f53a79f494ac2188f8c01500e5a916e321ae2f8b'
AND (
token = 'J8kn7rlx21fuHoq2T29cL+588fV5gR/gtPerSW7CFik='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)