UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gHCvKg9O3WCooB9Z0htoioV3CFFuMm7TV/hdqajxoZU='
WHERE
key_id = '578b4e4310b9099f025653a8b376f1b1421506625a32d90ae4ebc11700032dc6'
AND (
token = 'gHCvKg9O3WCooB9Z0htoioV3CFFuMm7TV/hdqajxoZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)