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