UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NXZZZvHrQmp8Vhe4+QozmhEqgX/OiShW9rVShs1zPR8='
WHERE
key_id = 'fa01cac47f2f9f285637912e92124ed0235432e89dabfc8609aff4f4893c908e'
AND (
token = 'NXZZZvHrQmp8Vhe4+QozmhEqgX/OiShW9rVShs1zPR8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)