UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BuRucsKGQN8wcwyio0RVSaa/OzJCA5s7PoD4dbXn0yg='
WHERE
key_id = 'b3516151c11e5932d44db141df735730760572a8625b9512c2a9a75b2a29f0e1'
AND (
token = 'BuRucsKGQN8wcwyio0RVSaa/OzJCA5s7PoD4dbXn0yg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)