UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NaVyiHdCwCZ//X/vnMtaAMxrzO95KchTRMCrJRG+4e0='
WHERE
key_id = '0d565099886bd8041fe64c1a4f54c32868a16429c74dc81e0a8a37d953979f4c'
AND (
token = 'NaVyiHdCwCZ//X/vnMtaAMxrzO95KchTRMCrJRG+4e0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)