UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HQg4JoyOcHoaPevc9yVGZxpqruuUoS0E/eMJmjHBo3k='
WHERE
key_id = '8961e749b4b70b32114dd4fd6c9f3f23003e6926f485a0be59618716fcf01779'
AND (
token = 'HQg4JoyOcHoaPevc9yVGZxpqruuUoS0E/eMJmjHBo3k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)