UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PSh0hZDAXMWdXiHXjii0Pas8c4GWTiDt0W+nfTGVVug='
WHERE
key_id = 'cb6643686387f94fe5c9ee23ef510ab5269f0dec30159f307cc9eb12b71a4c99'
AND (
token = 'PSh0hZDAXMWdXiHXjii0Pas8c4GWTiDt0W+nfTGVVug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)