UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xbWx9NhwZGw5FcPt51pLJ1gFy8nvGOVFQ2fx4bY0Q34='
WHERE
key_id = '59b28c6f5793c6137a90beb91cf01c6cd29bd7a06c8fc0c87babbdb367b45223'
AND (
token = 'xbWx9NhwZGw5FcPt51pLJ1gFy8nvGOVFQ2fx4bY0Q34='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)