UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NN9/nvKSdVErDqM85KiutsM5YSKAO3Bpd5vwgA7xHgI='
WHERE
key_id = '95caa0257cb01204b1772b91666452580ce8ea5d6b12b5fa2d94085fb60d8b7f'
AND (
token = 'NN9/nvKSdVErDqM85KiutsM5YSKAO3Bpd5vwgA7xHgI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)