UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nPJJi0zmJshFgIbqGXHxNNT5QhwjngYFBs9nw4sBcXg='
WHERE
key_id = 'f626c3fd7f5d2f81ccb2e94f5c7835e0152e07f76199c49f9b4e8286462db18a'
AND (
token = 'nPJJi0zmJshFgIbqGXHxNNT5QhwjngYFBs9nw4sBcXg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)