UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V7ifbMazd217dFtKHnJ6oytchr+HBswfg3XL+t2fiTw='
WHERE
key_id = '82cea1748c2195562c96b14607dda3f6f99dffda750d0f6a0819bc2061a6d23d'
AND (
token = 'V7ifbMazd217dFtKHnJ6oytchr+HBswfg3XL+t2fiTw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)