UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZxiyKR1FspkGEUf1+Dl59EfVkYKeH/tplX3DOV1Kz2Y='
WHERE
key_id = 'c6b1747f6f613596d7be3fc0da338b5af7d46095f5894b3f4c30502ee8692d5b'
AND (
token = 'ZxiyKR1FspkGEUf1+Dl59EfVkYKeH/tplX3DOV1Kz2Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)