UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pOWw697ZtQ1pplghYPI1x9cUSigTvwRrOvzgeW9yjS8='
WHERE
key_id = '8871592a88ea04c584cba888112b9cc6df89da92985e785df9b671511d03054e'
AND (
token = 'pOWw697ZtQ1pplghYPI1x9cUSigTvwRrOvzgeW9yjS8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)