UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9TjSVNAd7KUmXI5hs67T/JGhd5vSiEX01rMkR6mE4Lk='
WHERE
key_id = 'eba0c48352b38e2a90b09140d9f68f12b1c962cbe783b72751ab72f686317355'
AND (
token = '9TjSVNAd7KUmXI5hs67T/JGhd5vSiEX01rMkR6mE4Lk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)