UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4xmsJf1IX7Mpm7msICndBiKYXpUFCk2tjpxkymJaGfo='
WHERE
key_id = 'b22f50a73536876ce43eeea97e1b1bb5993e2e25a45c1528ace2e411a643ea40'
AND (
token = '4xmsJf1IX7Mpm7msICndBiKYXpUFCk2tjpxkymJaGfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)