UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zIdQQVZjHTGoTRUrCFQJ1zuPnIKi99y9td9LvwVv8o0='
WHERE
key_id = '76e42659cbf50e38c1e13eb8e6debc921944ce71527d1c7c57dcf098497b3f42'
AND (
token = 'zIdQQVZjHTGoTRUrCFQJ1zuPnIKi99y9td9LvwVv8o0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)