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