UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qr1uSZYIdoME8van873F4ikuifkVrFb2czwV83tBLj0='
WHERE
key_id = 'f72dfe024ec62784854fa32699b32a184b5cc9d6ee45f7efcd1bcfa536a218f4'
AND (
token = 'qr1uSZYIdoME8van873F4ikuifkVrFb2czwV83tBLj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)